/**
 * @program: clms-second
 * @description:
 * @author: mitu_echo
 * @create: 2021-07-31 17:02
 **/

package com.second.alipay.controller;

import com.alipay.api.AlipayApiException;
import com.second.alipay.pojo.utils.AlipayUtils;
import com.second.alipay.service.AlipayService;
import com.second.common.pojo.R;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@RequestMapping("/alipay")
public class AlipayController {

    @Autowired
    private AlipayService alipayService;

    @RequestMapping("/payMoney")
    private R payMoney(Integer orderMoney) throws Exception {

        return alipayService.payMoney(orderMoney);
    }

    /**
     * 使用支付宝默认的支付二维码支付后，展示给客户的数据
     * @return
     * @throws Exception
     */
    @RequestMapping("/returnUrl")
    private Object returnUrl()  {

        return "支付成功";
    }

    /**
     * 根据订单号，判断订单状态
     */
    @RequestMapping("/getAliPayStatus")
    public R getAliPayStatus(String orderId) throws AlipayApiException {

        return alipayService.getAliPayStatus(orderId);
    }
}
